package com.example.mapper;

import com.example.domain.Meteorology;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MeteorologyMapper {

    @Select("select * from wmy.meteorology")
    List<Meteorology> getAll();

    @Select("select * from wmy.meteorology where meteorology_id = #{meteorologyId}")
    Meteorology getById(Integer meteorologyId);

    @Insert("insert into wmy.meteorology (meteorology_temperature, meteorology_humidity, meteorology_co2, meteorology_illuminance, meteorology_updatetime) values (#{meteorologyTemperature}, #{meteorologyHumidity}, #{meteorologyCo2}, #{meteorologyIlluminance}, #{meteorologyUpdatetime})")
    boolean add(Meteorology meteorology);

    @Update("update wmy.meteorology set meteorology_temperature=#{meteorologyTemperature},meteorology_humidity=#{meteorologyHumidity},meteorology_co2=#{meteorologyCo2},meteorology_illuminance=#{meteorologyIlluminance},meteorology_updatetime=#{meteorologyUpdatetime} where meteorology_id = #{meteorologyId}")
    boolean update(Meteorology meteorology);

    @Delete("delete from wmy.meteorology where meteorology_id = #{meteorologyId}")
    boolean delete(Integer meteorologyId);

}
